export default {
  mounted(el, binding) {
    const setStyle = (dom, css) => {
      for (let key in css) {
        dom.style[key] = css[key]
      }
    }
    const selectWrap = el.querySelector('.el-scrollbar__wrap');
    const appendWrap = el.querySelector('.el-table__append-wrapper')
    setStyle(appendWrap, {
      width: selectWrap.clientWidth + 'px',
      position: 'sticky',
      left: 0,
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center'
    })
    selectWrap.addEventListener('scroll', function () {
      if (Math.abs(this.scrollHeight - this.scrollTop - this.clientHeight) < 1) {
        binding.value();
      }
    })
  }
}
